//
//  CZHomeTableViewCell.swift
//  weibo24
//
//  Created by 李文峰 on 16/3/4.
//  Copyright © 2016年 fengten. All rights reserved.
//

import UIKit

class CZHomeTableViewCell: UITableViewCell {
    
    var statuesViewModel: CZStatusViewModel?{
        didSet{
            Orginal.statuesViewModel = statuesViewModel
            footer.statueseViewModel = statuesViewModel
        }
    }

 //cell中添加3个view 
    
    //三部曲
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        //添加子控件方法调用
        
        setupUI()
        
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    func setupUI(){
        
        contentView.addSubview(Orginal)
        contentView.addSubview(footer)
        
        //约束
        Orginal.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(contentView.snp_top)
            make.left.equalTo(contentView.snp_left)
            make.right.equalTo(contentView.snp_right)
            make.bottom.equalTo(footer.snp_top)
        }
        
        footer.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(contentView.snp_left)
            make.right.equalTo(contentView.snp_right)
            make.bottom.equalTo(contentView.snp_bottom)
            make.top.equalTo(Orginal.snp_bottom)
            make.height.equalTo(40)
        }
        
    }
    
    //懒加载
    lazy var Orginal :CZOrginal = CZOrginal()
    
    lazy var footer: CZFooterView = CZFooterView()
}
